var log = [];
function print(value) {
	log.push(value);
}
function cont() {
	return new Continuation();
}
k=0;
function contTest() {
	var i = 0;
	var o = {j:0};
	var c = cont();
	
	if (c instanceof Continuation) {
		cc = c;
		c(1);
	}
	if (k++ > 5)
		return;
	i++;
	o.j++;
	print(i + " " + o.j + ' ' + k);
	cc(1);
}
function runtest() { // starting point
	contTest();
}
function getLogOutput() {
	return log.join("\n");	
}
handler = {};
function waitForHandler() {
	var future = new Future();
	handler.onFire = future.fulfill;
	future.result();
	print("handler finished");
}